package com.panshi;

import com.panshi.api.util.PageSizeVO;
import com.panshi.bean.*;
import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Collections;
import java.util.List;

@FeignClient(value = "iss-service-eureka",path = "iss")
@Component
public interface IssApi {
        @PostMapping("/findAll")//获取所有问题  根据主题获取问题 查询已回答未回答
        @ApiOperation("查询所有问题 根据主题获取问题 查询已回答未回答")
        public List<IssBean> findAllIss(@RequestBody PageModel page) throws Exception;

        @PostMapping("/findAll2")
        @ApiOperation("查询所有问题 首页的热榜")
        public List<IssBean> findAllIss2(@RequestBody PageModel page);

        @PostMapping("/findAll3")
        @ApiOperation("查询所有问题 首页的最新")
        public List<IssBean> findAllIss3(@RequestBody PageModel page);



        @PostMapping("/findTid")//查询主题
        @ApiOperation("查询问题所有主题")
        public List<IssBean> findAllTid();


        @PostMapping("/addIss")
        @ApiOperation("用户提出问题存入未审核表")
        public String initIss(@RequestBody IssBean iss);

        @PostMapping("/uploadImg")
        @ApiOperation("用户点击图片，上传到阿里云")
        public String uploadImg(MultipartFile file);


        @GetMapping("/deleteIss")
        @ApiOperation("用户删除自己提出的问题,state:0问题表删,1审核表删除")
        public String deleteIss(@RequestParam int qid, @RequestParam int state);


        @GetMapping("/readIss/{qid}")
        @ApiOperation(" //用户点击某个个问题根据问题id查询数据")
        public IssBean getByQid(@PathVariable int qid) ;

        @GetMapping("/readIss2/{qid}")
        @ApiOperation("用户点击某个个问题根据问题id查询数据(问题下所有答案)")
        public List<AnswerBean> getByQidAnswer(@PathVariable int qid);


        @GetMapping("/findHostIss")
        @ApiOperation("大家都在问")
        public List<IssBean> findHostIss(@RequestParam int tid,@RequestParam int i);

        @GetMapping("/aboutQa")
        @ApiOperation("点击问题后右边的相关推荐")
        public List<IssBean> aboutQa(@RequestParam int tid);

        @GetMapping("/initColl")
        @ApiOperation("用户点击收藏")
        public int initColl(@RequestParam int uid,@RequestParam int qid);


        @PostMapping("/userMessage")
        @ApiOperation("用户留言")
        public int userMessage(@RequestBody UserMessageBean um);


        @GetMapping("/findColumn")
        @ApiOperation("查询栏目信息")
        public List<ColumnBean> findColumn();






        //管理员接口======================================================================================================
        @PostMapping("/adminFindAll")
        @ApiOperation("管理员查询所有问题")
        public PageSizeVO<List<IssBean>> adminFindAll(@RequestBody PageSizeVO pageSizeVO);

        @PostMapping("/adminFindNoAll")
        @ApiOperation("管理员问题审核表所有问题")
        public PageSizeVO<List<IssBean>> adminFindNoAll(@RequestBody PageSizeVO pageSizeVO);

        @GetMapping("/adminUpdateQa")
        @ApiOperation("管理员修改问题表")
        public int adminUpdateQa(@RequestParam int qid,@RequestParam int state,@RequestParam int tid) throws  Exception;

        @PostMapping("/initQa")
        @ApiOperation("审核问题进入问题表")
        public int initQa(@RequestBody IssBean iss) throws Exception;

        @PostMapping("/updateColumn")
        @ApiOperation("管理员修改栏目")
        public int updateColumn(@RequestBody ColumnBean cb);

        @PostMapping("/initColumn")
        @ApiOperation("管理员增加栏目")
        public int initColumn(@RequestBody ColumnBean cb);
}
